﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;

namespace SBPweb.Communication.Client.Controls.Xmpp.Themes
{
    
    partial class Generic : ResourceDictionary
    {
        private static Generic instance;

        static Generic()
        {
            instance = new Generic();
            instance.InitializeComponent();
        }

        public static Generic Instance
        {
            get
            {
                return instance;
            }
        }

        public object FindName(string name)
        {
            //TODO: SL3
#if SL3
            foreach (object key in this.Keys)
            {
                if (!key.Equals(name))
                {
                    continue;
                }
                object value = this[key];
                DependencyObject dO = value as DependencyObject;
                if (dO == null && value != null)
                {
                    return value;
                }
                string nm = dO.ReadLocalValue(FrameworkElement.NameProperty).ToString();
                if (nm == name)
                {
                    return value;
                }
            }
            return null; //(this as FrameworkElement).FindName(name);
#else 
            return null;
#endif
        }

        //private void cbPresence_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    Connections.ConnectionsView cv = sender as Connections.ConnectionsView;
        //    if (cv != null)
        //    {
        //        cv.OnPresenceSelectionChanged(sender, e);
        //    }
        //}

        //private void cbActions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    Contacts.ContactsView cv = sender as Contacts.ContactsView;
        //    if (cv != null)
        //    {
        //        cv.OnItemActionsSelectionChanged(sender, e);
        //    }
        //}

    }

}